<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jq/jquery1.9/jquery-1.9.0.js"></script>
    <script>
        $(function(){
            // var n=prompt("请输入您想要的li:")*1;
            // $("li:eq("+(n-1)+")").css("background","red");
            //eq()方法
            // $("li").eq(n-1).css("background","yellow");

            // first()和last()方法
            // $("li").first().css("background","red");
            // $("li").last().css("background","green");

            //filter()对当前选中元素进行筛选过滤
            // $("li").filter(".hello").css("background","yellow");

            //find()在当前元素内部进行查找对应的元素
            // $("li").find(".hello").css("background","hotpink");

            // slice()选取匹配的子集
            // $("li").slice(2,4).css("background","red");//[2,4)
            $("li").slice(2).css("background","red");//从索引为2的开始，默认截取到末尾

            // data()和removeData()方法,在元素上存储数据和移除数据
            // jQuery对象.data("对应的属性名",对应的值)
            $("ul").data("name","alice");
            $("ul").data("age",20);
            console.log( $("ul").data("name"));
            console.log( $("ul").data("age"));
            $("ul").removeData("name");//删除数据
            console.log( $("ul").data("name"));
            console.log( $("ul").data("age"));

        });

 

        
    </script>
</head>
<body>
    <ul>
        <li>li01</li>
        <li class="hello">li02</li>
        <li>li03</li>
        <li>li04</li>
        <li>li05
            <span class="hello">span</span>
            <span class="hello">span</span>
            <span id="hello">span</span>
        </li>
        <li>li06</li>
    </ul>
</body>
</html>